package 面试.OOM;/*
 *@Author: helen
 *@Date:   2021/7/30 16:27
 *@Description:
 */

import java.util.ArrayList;

//-Xms1m -Xmx8m -XX:+HeapDumpOnOutOfMemoryError
public class demo02 {
    byte[] array = new byte[1*1024*1024];

    public static void main(String[] args) {
        ArrayList<demo02> list = new ArrayList<>();
        int count = 0;
        try{
            while (true){
                list.add(new demo02());
                count++;
            }
        }catch (Exception e){
            System.out.println("count:" + count);
            e.printStackTrace();
         }
    }
}
